<?php 
include  "../../config/seguridad.php"; /*Valida el inico de sesion*/
?>
<!doctype html>
<html lang="es">
<head>
  <meta charset="UTF-8">
  <title>Agregar usuarios</title>
  <link rel="stylesheet" type="text/css" href="mtb.css"/>
  <link rel="stylesheet" type="text/css" href="main.css"/>
  <link rel="stylesheet" type="text/css" href="ceGrid.css"/>
  <script type="text/javascript" src="jquery.js"></script>
<link rel="stylesheet" type="text/css" href="index.css" />
  
  <script>

   
    function soloLetras(e){
       key = e.keyCode || e.which;
       tecla = String.fromCharCode(key).toLowerCase();
       letras = " áéíóúabcdefghijklmnñopqrstuvwxyz";
       especiales = "8-37-39-46";

       tecla_especial = false
       for(var i in especiales){
            if(key == especiales[i]){
                tecla_especial = true;
                break;
            }
        }

        if(letras.indexOf(tecla)==-1 && !tecla_especial){
            return false;
        }
    }
</script>
  
  
</head>

<body>
  <br>
  <br>
  <a class="btn" href='index.php'>Regresar</a>
  <br>
	<div id="content-mt">
		<!--action="Insert.php"-->
		<form name="Reg_academico"  method="POST" id="form-pro" class="style" > 

<div id="div01"  class="curved" >
<table id = "tab01">
<div id="error"></div>
	<tr align="center">
	<td>Código</td>
              <td><label>
            <input type="text" name="Txt_Id" id="Txt_Id" value = ""  maxlength="40" onkeypress="return soloLetras(event)" /> 
         
            </label></td>
       </tr>

   		  <tr>
	     		<td>Nombre</td>
        		<td><label>
             		<input type="text" name="Txt_Nom" id="Txt_Nom" placeholder="Ingrese el nombre" value = "" maxlength="50"  onkeypress="return soloLetras(event)"/> 
         
         			</label></td>
   		 </tr>
		<tr>
	    	    <td>Primer apellido</td>
         	    <td><label>
         		<input type="text" name="Txt_Ape1" id="Txt_Ape1" value = ""  maxlength="40" onkeypress="return soloLetras(event)" /> 
         
         		</label></td>
       </tr>

    <td>Segundo apellido</td>
              <td><label>
            <input type="text" name="Txt_Ape2" id="Txt_Ape2" value = ""  maxlength="40" onkeypress="return soloLetras(event)" /> 
         
            </label></td>
       </tr>

    <td>Contraseña</td>
              <td><label>
            <input type="password" name="Txt_Con" id="Txt_Con" value = ""  maxlength="40" /> 
         
            </label></td>
       </tr> 

    <td>Confirmar contraseña</td>
              <td><label>
            <input type="password" name="Txt_Confir" id="Txt_Confir" value = ""  maxlength="40" /> 
         
            </label></td>
       </tr>
       <tr>
         <td></td>
         <td><label>
         <input type="submit" name="Agregar_Btn" class="btn-m"  id="Agregar_Btn" value="Agregar" />
         </label></td>
     </tr>
     </tr>
</table> 
 </form>
</div>
</div>
</body>

<!--script de validacion formulario-->
<script type="text/javascript">
    $(function(){
      $("#Agregar_Btn").click(function(){
        $('this').preventDefault;
         var pk = $('#Txt_Id').val();; // El script a dónde se realizará la petición.
         var nom= $('#Txt_Nom').val();
         var ape1= $('#Txt_Ape1').val();
         var ape2= $('#Txt_Ape2').val(); 
         var pass=$('#Txt_Con').val(); 
         var pass2=$('#Txt_Confir').val();
         var data1="Txt_Id="+pk+"&Txt_Nom="+nom+"&Txt_Ape1="+ape1+"&Txt_Ape2="+ape2+"&Txt_Con="+pass+"&Txt_Confir="+pass2;
         $.ajax({
          type: "POST",
          url: "insert.php",
                   data: data1, // Adjuntar los campos del formulario enviado.
                   success: function(data)
                   {
                    $("#error").html(data);
                   }
               });
            return false; // Evitar ejecutar el submit del formulario.
        });
      });
</script>
</html>

